package com.boliq.lol.ui.fragment;


import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.boliq.lol.R;
import com.boliq.lol.adapter.NewsAdapter;
import com.boliq.lol.base.BaseFragment;
import com.boliq.lol.bean.NewsBean;

import java.util.ArrayList;
import java.util.List;

public class ConcrenFragment  extends BaseFragment {
    private RecyclerView listView;
    private NewsAdapter mNewsAdapter;
    @Override
    protected int rootLayout() {
        return R.layout.fragment_concren;
    }

    @Override
    protected void initView(View view) {
        listView = view.findViewById(R.id.rv_news_content);
        listView.setLayoutManager(new LinearLayoutManager(getActivity()));


        mNewsAdapter = new NewsAdapter();

        mNewsAdapter.setList(init());
        listView.setAdapter(mNewsAdapter);

    }
    //这里适用于模拟数据创建的假数据
    private String[] title = new String[]{"Top5:Mole发条协奏背水终斩敌",
            "LPL春季赛3月9日首发名单，Lwx、Kramer下路交锋",
            "2021LPL春季赛第七周最佳阵容",
            "《LPL小蜜蜂观赛福袋》抽奖活动获奖玩家公式",
            "小蜜蜂宝典-永久皮肤宝箱重开功能上线公告",
            "3月12日免费英雄更新公告",
            "LPL春季赛3月11日首发名单，Scout中路交手icon",
            "英雄麦克疯：Zhou关键一钩，JackeyLove再现一打...",
            "GEN vs T1赛事预热：传统强队的碰撞一触即发",
            "Top：Karsa毁灭冲锋 单骑成万军",
            "LPL春季赛3月10日首发名单，SofM野区对决Haro",
            "选手靠谱时刻：宁王搞笑解说语录",
            "赢就是我的忍道！IG对阵TES",
            "我是选手：炼狱扳机，莲华旋转",
            "LPL春季赛3月6日首发名单，Xiaohu交锋Flandre"
    };
    private int[] cover = new int[]{
            R.drawable.vateral_1,
            R.drawable.vateral_2,
            R.drawable.vateral_3,
            R.drawable.vateral_4,
            R.drawable.vateral_5,
            R.drawable.vateral_6,
            R.drawable.vateral_7,
            R.drawable.vateral_8
    };

    private List<NewsBean> init() {
        List<NewsBean> list = new ArrayList<>();
        for (int i = 0; i < 30; i++) {
            list.add(new NewsBean()
                    .setTitle(title[i % title.length])
                    .setHot((int) (Math.random() * 1000))
                    .setDrawable(cover[i % cover.length]));
        }
        return list;
    }
    @Override
    protected void initData() {

    }

    @Override
    protected void bindEvent() {

    }
}
